package com.osfw.activiti.enums;

import com.osfw.activiti.enums.resource.ProcdefShareState;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 流程审批结果
 */
public enum ProcApprovalResult {
    AGREE(1, "同意"),
    DISAGREE(2, "不同意"),
    GOBACK(3, "退回");

    private Integer result;
    private String name;

    ProcApprovalResult(Integer result, String name) {
        this.result = result;
        this.name = name;
    }

    public Integer getResult() {
        return result;
    }

    public String getName() {
        return name;
    }


    public static ProcApprovalResult getProcApprovalResult(Integer result) {
        for (ProcApprovalResult resultEnum : values()) {
            if (resultEnum.getResult().intValue() == result.intValue()) {
                return resultEnum;
            }
        }
        return null;
    }

    public static Map<Integer, String> getProcApprovalResultList() {
        HashMap<Integer, String> map = new LinkedHashMap<>();
        for (ProcApprovalResult resultEnum : values()) {
            map.put(resultEnum.getResult(), resultEnum.getName());
        }
        return map;
    }


}
